package cn.tedu.knows.sys.controller;


import cn.tedu.knows.commons.exception.ServiceException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
@Slf4j
public class ExceptionControllerAdvice {
    @ExceptionHandler
    public String handleServiceException(ServiceException e){
        log.error("发生业务异常",e);
        return e.getMessage();
    }
    @ExceptionHandler
    public String handleException(Exception e){
        log.error("发生其他异常");
        return e.getMessage();
    }
}
